package org.vectrics.struts.tags;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import java.io.IOException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.log4j.*;
import java.text.SimpleDateFormat;



public class TextGraphicTag extends TagSupport {
    static private Category log = Category.getInstance(TextGraphicTag.class);
    private String server = null;
    private static SimpleDateFormat historyDateFormat = new SimpleDateFormat("MM-dd-yyyy");
    
    public TextGraphicTag() {
    }
    
    public int doStartTag() throws JspException  {
    	log.debug("doStartTag() called");
    	HttpServletRequest request = (HttpServletRequest)this.pageContext.getRequest();
    	
    	String html = "<img src=\"http://" + server + "/graphics-gen/mike.jpg?type=text&text=Mike%20Moore&size=" +
    			"100&width=900&height=400"+  "\">";
    	
	    log.debug("doStartTag() - writing output...");
	    JspWriter writer = pageContext.getOut();
	    try {
	    	writer.print(html);
	    }
	    catch (IOException ex) {
	    	throw new JspException("IOException attempting to write tag to output. " + ex.getMessage());
	    }
	    return(EVAL_PAGE);
    }
}
